<script setup>
import {
  ListOutline,
  SquareOutline,
  ChatbubblesOutline,
  DocumentTextOutline,
  ImagesOutline,
  CardOutline,
  RadioButtonOnOutline,
  ImagesSharp,
  PricetagOutline,
  DocumentOutline,
  ToggleOutline,
  CloudUploadOutline
} from '@vicons/ionicons5'
import { useRouter } from 'vue-router'
import { RouteEnum } from '@/enum/RouteEnum.js'
const router = useRouter()
const items = [
  { name: '分页列表', icon: ListOutline,url:"/exhibition",id:RouteEnum.Exhibition },
  { name: '模态框', icon: SquareOutline },
  { name: '对话框', icon: ChatbubblesOutline },
  { name: '分页', icon: DocumentTextOutline },
  { name: '图标', icon: ImagesOutline },
  { name: '卡片', icon: CardOutline },
  { name: '按钮', icon: RadioButtonOnOutline },
  { name: '轮播图', icon: ImagesSharp },
  { name: '标签', icon: PricetagOutline },
  { name: '表单', icon: DocumentOutline },
  { name: '开关', icon: ToggleOutline },
  { name: '上传', icon: CloudUploadOutline }
]
const handleItemClick = (item) => {
  if (item.url) {
    router.push({
      path: item.url,
      query: {
        id: item.id
      }
    })
  }
}
</script>

<template>
<div class="container w-full h-full p-4 grid grid-cols-4 gap-4">
  <div v-for="(item, index) in items" :key="index" @click="handleItemClick(item)" class="feature-card">
    <div class="icon-container">
      <component :is="item.icon" class="icon" />
    </div>
    <div class="text">{{ item.name }}</div>
  </div>
</div>
</template>

  <style scoped>
  .container {
    background-color: #f5f5f5;
  }

  .feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
  }

  .feature-card:hover {
    transform: translateY(-5px);
  }

  .icon-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
  }

  .icon {
    font-size: 32px;
  }

  .text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
  }

  .icon {
  width: 60px;
  height: 60px;
  color: #657ae4;
}
  </style>
